package com.rickpan.util;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 密码初始化工具
 * 用于生成开发者密码的BCrypt哈希值
 */
public class PasswordInitializer {
    
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        
        // 默认开发者密码
        String defaultPassword = "dev123456";
        String hashedPassword = encoder.encode(defaultPassword);
        
        System.out.println("=== 开发者密码初始化 ===");
        System.out.println("原始密码: " + defaultPassword);
        System.out.println("BCrypt哈希: " + hashedPassword);
        System.out.println();
        System.out.println("SQL更新语句:");
        System.out.println("UPDATE developer_config SET config_value = '" + hashedPassword + "' WHERE config_key = 'developer.access.password';");
        System.out.println();
        System.out.println("请使用密码: " + defaultPassword + " 进行测试");
    }
}
